package com.hy.erp.inventory.service;

import java.util.List ;

import javax.ejb.Stateless ;

import org.jboss.seam.ScopeType ;
import org.jboss.seam.annotations.Name ;
import org.jboss.seam.annotations.Scope ;
import org.jboss.seam.async.Schedule ;

import com.hy.enterprise.architecture.foundation.ArchitectureFoundationException;
import com.hy.enterprise.framework.service.business.AbstractBusinessService;
import com.hy.erp.inventory.dao.interfaces.IQualityControlMannerDao;
import com.hy.erp.inventory.dao.interfaces.IUserDao;
import com.hy.erp.inventory.pojo.QualityControlManner;
import com.hy.erp.inventory.pojo.interfaces.IQualityControlManner;
import com.hy.erp.inventory.pojo.interfaces.IUser;
import com.hy.erp.inventory.service.interfaces.IQualityControlMannerService;
/**
 * 
 * <ul>
 * <li>开发作者：汤莉</li>
 * <li>设计日期：2010-10-13；时间：上午09:43:57</li>
 * <li>类型名称：QualityControlMannerService</li>
 * <li>设计目的：</li>
 * </ul>
 * <ul>
 * <b>修订编号：</b>
 * <li>修订日期：</li>
 * <li>修订作者：</li>
 * <li>修订原因：</li>
 * <li>修订内容：</li>
 * </ul>
 */
@Name("qualityControlMannerService")
@ Scope ( ScopeType.STATELESS )
@ Stateless
public class QualityControlMannerService
										extends
										AbstractBusinessService < IQualityControlManner >
																				implements
																				IQualityControlMannerService
{

	/**
	 * <ul>
	 * <li>开发作者：汤莉</li>
	 * <li>设计日期：2010-10-13；时间：上午09:43:54</li>
	 * <li>字段类型：long；字段名称：serialVersionUID</li>
	 * <li>设计目的：</li>
	 * </ul>
	 * <ul>
	 * <b>修订编号：</b>
	 * <li>修订日期：</li>
	 * <li>修订作者：</li>
	 * <li>修订原因：</li>
	 * <li>修订内容：</li>
	 * </ul>
	 */
	private static final long	serialVersionUID	=
														2477728249892191098L ;
	/**
	 * 
	 * 构造函数
	 */
	public QualityControlMannerService()
	{
		super ( );
	}

	@ Override
	public boolean addQualityControlManner (
												QualityControlManner manner )
	{
		if(manner==null)
		{
			return true;
		}
		else
		{
			IQualityControlMannerDao dao=( IQualityControlMannerDao ) this.getDao ( IQualityControlManner.class );
			IQualityControlManner iQualityControlManner=manner;
			return dao.persist ( iQualityControlManner ) ;
		}
	}

	@ Override
	public Integer removeQualityControlManner (
												String [ ] Ids )
	{
		if ( ( null == Ids )
			     || ( Ids.length == 0 ) )
			{
				return new Integer (
				                     0 ) ;
			}
			else
			{
				IQualityControlMannerDao dao=( IQualityControlMannerDao ) this.getDao ( IQualityControlManner.class );
				return dao.remove ( Ids );
			}
	}

	@ SuppressWarnings ( "unused" )
	@ Override
	public boolean modifyQualityControlManner (
												QualityControlManner manner )
	{
		if ( ( null == manner ) || ( null == manner.getIdentifier ( ) ))
		{
			return true;
		}
		else
		{
			IQualityControlMannerDao dao=( IQualityControlMannerDao ) this.getDao ( IQualityControlManner.class );
			IQualityControlManner iQualityControlManner=manner;
			
			if ( null == iQualityControlManner )
			{
				throw new ArchitectureFoundationException (
				                                            "修改用户实体数据时发生错误，所需要修改的实体在数据库中并不存在" ) ;
			}
			return (dao.merge ( iQualityControlManner )!=null) ;
		}
	}

	@ Override
	public String [ ] addQualityControlManner (
												Object [ ] objects )
	{
		IQualityControlMannerDao dao=( IQualityControlMannerDao ) this.getDao ( IQualityControlManner.class );
		QualityControlManner[] manners=new QualityControlManner[objects.length];
		for ( int i =
						0 ; i < objects.length ; i ++ )
		{
			QualityControlManner manner=( QualityControlManner ) objects[i];
			manners[i]=manner;
		}
		return dao.persist ( manners ) ;
	}

	@ Override
	public List < IQualityControlManner > getAllQualityControlManner ( )
	{
		IQualityControlMannerDao dao=( IQualityControlMannerDao ) this.getDao ( IQualityControlManner.class );
		return dao.find ( ) ;
	}

	@ Override
	public String [ ] modifyQualityControlManner (
													Object [ ] objects )
	{
		if (  null == objects ) 
		{
			return null;
		}
		else
		{
			IQualityControlMannerDao dao=( IQualityControlMannerDao ) this.getDao ( IQualityControlManner.class );
			QualityControlManner[] types=new QualityControlManner[objects.length];
            for(int i=0;i<objects.length;i++)
            {
            	QualityControlManner type=( QualityControlManner ) objects[i];
            	types[i]=type;
            }
			
			return dao.merge ( types );
		}
	}

}
